<template>
	<view>
		<view class="common-lst" v-if="obj.commodityEntitys.length>0">

			<image :src="obj.img_url" class="img-block"></image>

			<view class="content">
				<view class="hint-block">
					<view class="left-img center">
						<image :src="leftIcon" class="auto-img"></image>
					</view>
					<view class="title">{{title}}</view>
					<view class="right-img center">
						<image :src="rightIcon" class="auto-img"></image>
					</view>
				</view>
				<block v-for="(item,index) in obj.commodityEntitys" :key="index">
					<view style="margin-top: 32rpx;padding-bottom: 32rpx;">
						<view class="item" @tap="itemClick(item)">
							<view class="img">
								<image :src="item.main_image" class="auto-img img-radius"></image>
							</view>
							<view class="right-info">
								<view class="title">{{item.title}}</view>
								<view class="nums-block">
									<view class="nums">
										<span>¥</span>{{item.price/100}}
									</view>
									<view class="buy-img center">
										<image :src="buyIcon" class="auto-img"></image>
									</view>
								</view>
							</view>
						</view>
					</view>
				</block>
			</view>
		</view>
		<view v-if="obj.commodityEntitys.length==0" class="no-emty" style="font-size: 26rpx;color: #999;">暂无信息</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				title: '',
				leftIcon: require('@/static/cart/leftBlock.png'),
				rightIcon: require('@/static/cart/rightBlock.png'),
				buyIcon: require('@/static/category/buy.png'),
				lst: [],
				obj: {},
			}
		},
		onLoad(e) {

			console.log('e', e)
			if (e.type == 1) {
				this.title = '爆款推荐'
			} else {
				this.title = '严选产品'
			}
			uni.setNavigationBarTitle({
				title: this.title
			})
			this.obj = uni.getStorageSync('distributionListt') || {}
		},
		methods: {
			itemClick(item) {
				uni.navigateTo({
					url: '/pages/shopDetail/shopDetail?goodsId=' + item.id
				})
			},

		}
	}
</script>

<style lang="scss">
	.img-block {
		height: 320rpx;
		width: 100%;
	}

	.no-emty {
		display: flex;
		align-items: center;
		justify-content: center;
		margin-top: 24rpx;
	}

	.content {
		padding: 0 32rpx;
		margin-top: 32rpx;
		margin-bottom: 40rpx;
	}

	.hint-block {
		display: flex;
		align-items: center;
		justify-content: center;

		.left-img {
			width: 106rpx;
			height: 12rpx;

		}

		.title {
			margin: 0 18rpx;
			font-size: 28rpx;
			font-weight: 500;
			color: rgba(0, 0, 0, 1);
		}

		.right-img {
			width: 106rpx;
			height: 12rpx;

		}
	}

	.item {
		display: flex;
		align-items: center;
		justify-content: center;
		height: 188rpx;
		margin: 6rpx 0rpx 24rpx 0rpx;
	}

	.img {
		flex: none;
		width: 188rpx;
		height: 188rpx;
		border-radius: 8rpx;
	}

	.right-info {
		flex: auto;
		margin-left: 16rpx;
		display: flex;
		flex-direction: column;
		height: 100%;

		justify-content: flex-start;

		.title {
			margin-top: 10rpx;
			font-size: 30rpx;
			font-weight: 500;
			color: rgba(0, 0, 0, 1);
			height: 144rpx;
		}

		.nums-block {
			width: 100%;
			height: 44rpx;
			flex: none;
			display: flex;
			align-items: center;

			.nums {
				color: rgba(203, 60, 40, 1);
				flex: auto;
				font-size: 32rpx;

				span {
					font-size: 22rpx;

				}
			}

			.buy-img {
				flex: none;
				width: 44.19rpx;
				height: 44rpx;
				border-radius: 50%;

			}
		}
	}
</style>
